package com.fjw.service.impl;

import com.fjw.dao.StudentDao;
import com.fjw.dao.impl.StudentDaoImpl;
import com.fjw.entity.Student;
import com.fjw.service.StudentService;

import java.sql.SQLException;
import java.util.List;

public class StudentServiceImpl  implements StudentService {
    private StudentDao studentDao = new StudentDaoImpl();
    @Override
    public List<Student> selectAllList() {
        try {
            return studentDao.selectAllList();
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public Student selectBySid(Integer sid) {
        try {
            return studentDao.selectBySid(sid);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public int updateStudent(Student student) {
        try {
            return studentDao.updateStudent(student);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public int deleteBySid(Integer sid) {
        try {
            return studentDao.deleteBySid(sid);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public int addStudent(Student student) {
        try {
            return studentDao.addStudent(student);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}
